package com.qf.dbUtil.controller.api;

import com.qf.dbUtil.common.result.R;
import com.qf.dbUtil.common.result.ResponseEnum;
import com.qf.dbUtil.entity.User;
import com.qf.dbUtil.service.impl.UserServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 功能说明
 *
 * @author yihuan
 * @data 2020-10-15  10:22:59
 */
@RestController
@CrossOrigin(origins = "*",maxAge = 3600)
@RequestMapping("/api")
@Api(description = "门户网站-Api")
@Slf4j
public class WebController {
    @Autowired
    private UserServiceImpl userService;
    /**
     *  根据用户id 查询用户的信息
     */
    @GetMapping("/user/{id}")
    @ApiOperation("根据用户id 查询用户的信息")
    public R findUserById(
            @ApiParam(value = "用户id",required = true)@PathVariable("id") Integer id){
        User user = userService.findUserById(id);
        log.debug("controller - debug");
        log.info("controller - info");
        return new R(ResponseEnum.SUCCESS,user) ;
    }
}
